//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef __ELASTOS__ELADBGAGENT_ELAMSTAT_H__
#define __ELASTOS__ELADBGAGENT_ELAMSTAT_H__

#ifdef _ELADBGAGENT

/* DBG_CONTROL_REPORT
 *
 * This structure contains machine specific data passed to the debugger
 * when a Wait_State_Change message is sent.  Idea is to allow debugger
 * to do what it needes without reading any more packets.
 * Structure is filled in by KdpSetControlReport
 */

#define DBG_MAX_STREAM 16

typedef struct _DBG_CONTROL_REPORT
{
    UInt32  Dr6;
    UInt32  Dr7;
    UInt16  InstructionCount;
    UInt16  ReportFlags;
    Byte    InstructionStream[DBG_MAX_STREAM];
    UInt16  SegCs;
    UInt16  SegDs;
    UInt16  SegEs;
    UInt16  SegFs;
    UInt32  EFlags;
} _DBG_CONTROL_REPORT;

/* DBG_CONTROL_SET
 *
 * This structure control value the debugger wants to set on every
 * continue, and thus sets here to avoid packet traffic.
 */
typedef struct _DBG_CONTROL_SET
{
    UInt32  TraceFlag;                  /* WARNING: This must NOT be a BOOLEAN,
                                             or host and target will end
                                             up with different alignments! */
    UInt32  Dr7;
    UInt32  CurrentSymbolStart;         /* Range in which to trace locally */
    UInt32  CurrentSymbolEnd;
} _DBG_CONTROL_SET;

/* Special Registers for i386
 */
typedef struct _DBG_DESCRIPTOR
{
    UInt16 Pad;
    UInt16 Limit;
    UInt32 Base;
} DBG_DESCRIPTOR, *PDBG_DESCRIPTOR;

typedef struct _DBG_SPECIAL_REGISTERS
{
    UInt32 Cr0;
    UInt32 Cr2;
    UInt32 Cr3;
    UInt32 Cr4;
    UInt32 KernelDr0;
    UInt32 KernelDr1;
    UInt32 KernelDr2;
    UInt32 KernelDr3;
    UInt32 KernelDr6;
    UInt32 KernelDr7;
    DBG_DESCRIPTOR Gdtr;
    DBG_DESCRIPTOR Idtr;
    UInt16 Tr;
    UInt16 Ldtr;
    UInt32 Reserved[6];
} DBG_SPECIAL_REGISTERS, *PDBG_SPECIAL_REGISTERS;

/* Processor State frame: Before a processor freezes itself, it
 * dumps the processor state to the processor state frame for
 * debugger to examine.
 */
typedef struct _DBG_PROCESSOR_STATE
{
    ELADBGCXTINFO ContextFrame;
    DBG_SPECIAL_REGISTERS SpecialRegisters;
} DBG_PROCESSOR_STATE, *PDBG_PROCESSOR_STATE;

#endif //_ELADBGAGENT

#endif //__ELASTOS__ELADBGAGENT_ELAMSTAT_H__
